package top.jle.wx.proxy.api.message;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import top.jle.wx.proxy.annotation.AccessToken;
import top.jle.wx.proxy.api.ResponseBack;
import top.jle.wx.proxy.constant.MessageOption;
import top.jle.wx.proxy.facade.MessageFacade;

@RestController
@RequestMapping("/msg")
@AccessToken
@Tag(name = "消息API")
public class MessageAPI {

    @Autowired
    MessageFacade messageFacade;
    @Operation(summary = "发送消息")
    @PostMapping(value = "/sendAll",consumes = MediaType.TEXT_PLAIN_VALUE)
    public ResponseBack<Boolean> sendAll(@RequestBody String content, @RequestParam MessageOption.MessageType messageType){
        messageFacade.sendAllMsg(messageType,content);
        return ResponseBack.success(true);
    }

}
